<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/Timo">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
    <link rel="stylesheet" th:href="@{/lib/zTree_v3/css/zTreeStyle/zTreeStyle.css}" type="text/css">
</head>
<body class="timo-layout-page">
    <div class="layui-card">
        <div class="layui-card-header timo-card-header">
            <span><i class="fa fa-bars"></i> 轮播图</span>
            <i class="layui-icon layui-icon-refresh refresh-btn"></i>
            <!--<a th:href="@{/system/user/export}"><i class="fa fa-download"></i></a>-->
        </div>
        <div class="layui-card-body">
            <div class="layui-row timo-card-screen put-row">
                <div class="pull-right screen-btn-group">
                    <div class="btn-group-left">
                        <button class="layui-btn open-popup" data-title="添加轮播图" th:attr="data-url=@{/mains/banner/add}"  data-size="auto"><i class="fa fa-plus"></i> 添加</button>
                    </div>
                </div>
            </div>
            <div class="timo-table-wrap">
                <table class="layui-table timo-table">
                    <thead>
                    <tr>
                        <th class="timo-table-checkbox">
                            <label class="timo-checkbox"><input type="checkbox">
                                <i class="layui-icon layui-icon-ok"></i></label>
                        </th>
                        <th>名称</th>
                        <th>图片预览</th>
                        <th>是否跳转</th>
                        <th>跳转类型</th>
                        <th>跳转地址</th>
                        <th>顺序</th>
                        <th>提交时间</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="item:${list}">
                        <td><label class="timo-checkbox"><input type="checkbox" th:value="${item.id}">
                            <i class="layui-icon layui-icon-ok"></i></label></td>
                        <td th:text="${item.names}"></td>
                        <td>
                            <a class="open-popup"  style="cursor: pointer" th:attr="data-url=@{${item.imgUrl}}" data-size="600,570" href="#">预览</a>
                        </td>
                        <th:block th:switch="${item.forwards}">
                            <td th:case="0" style="color: #8F1D78">不跳转</td>
                            <td th:case="1" style="color: #1E9FFF">跳转</td>
                        </th:block>
                        <th:block th:switch="${item.kinds}">
                            <td th:case="0" style="color: #01AAED">外部链接</td>
                            <td th:case="1" style="color: #44B549">小程序页</td>
                            <td th:case="2" style="color: #8F1D78">不跳转</td>
                        </th:block>
                        <td th:text="${item.imgLinks}"></td>
                        <td>
                            <span th:text="${item.numbers}"></span>
                            <a class="open-popup" data-title="修改顺序" th:attr="data-url=@{'/mains/banner/orders/'+${item.id}}"  data-size="375,260" href="#">修改顺序</a>
                        </td>
                        <td th:text="${#dates.format(item.createTime,'yyyy-MM-dd HH:mm:ss')}"></td>
                        <th:block th:switch="${item.states}">
                            <td th:case="0" style="color: #00B83F">启用中</td>
                            <td th:case="1" style="color: #FF0000">停用</td>
                        </th:block>
                        <td>
                            <th:block th:if="${item.states==0}">
                                <a class="open-popup" data-title="详细信息" th:attr="data-url=@{'/mains/banner/detail/'+${item.id}}"  data-size="800,600" href="#">详细</a>
                                <a class="ajax-get" th:attr="data-msg='您是否要停用'+${item.names}" th:href="@{'/mains/banner/status/1/'+${item.id}}">停用</a>
                            </th:block>
                            <th:block th:if="${item.states==1}">
                                <a class="open-popup" data-title="编辑Banner" th:attr="data-url=@{'/mains/banner/edit/'+${item.id}}"  data-size="600,570" href="#">编辑</a>
                                <a class="open-popup" data-title="详细信息" th:attr="data-url=@{'/mains/banner/detail/'+${item.id}}"  data-size="800,600" href="#">详细</a>
                                <a class="ajax-get"  th:attr="data-msg='您是否要启用'+${item.names}" th:href="@{'/mains/banner/status/0/'+${item.id}}">启用</a>
                                <a class="ajax-get"  th:attr="data-msg='您是否删除'+${item.names}" th:href="@{'/mains/banner/del/'+${item.id}}">删除</a>
                            </th:block>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div th:replace="/common/fragmentSelf :: page"></div>
        </div>
    </div>
<script th:replace="/common/template :: script"></script>
<script type="text/javascript" th:src="@{/js/plugins/jquery-3.3.1.min.js}"></script>
<script type="text/javascript" th:src="@{/lib/zTree_v3/js/jquery.ztree.core.min.js}"></script>
<script type="text/javascript" th:src="@{/js/timoTree.js}"></script>
<script type="text/javascript">
    var local = window.localStorage;
    // 树形菜单
    $.fn.selectTree({
        rootTree: '全部',
        onSelected: function(treeNode){
            local.setItem('deptTitle', treeNode.name);
        }
    });
</script>
</body>
</html>
